const cacheMap: any = {};

export const getMapByCode = async (code?: string) => {
  const finalCode = code || '100000';
  if (cacheMap[finalCode]) return cacheMap[finalCode];
  const res = await fetch(`https://pub-upload.oss-cn-shenzhen.aliyuncs.com/static/mci-map-json/${finalCode}.json`);
  const result = await res.json();
  cacheMap[finalCode] = result;
  return result;
};
